package com.rt.java.time;

import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.TimeUnit;

public class DurationDemo {
    public static void main(String[] args) throws InterruptedException {
        Instant now = Instant.now();
        TimeUnit.SECONDS.sleep(3);
        Duration duration = Duration.between(now, Instant.now());
        duration.toMillis(); // 3000 ms
    }
}
